<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/lib/jquery-3.3.1.min.js"></script>
    <script src="../js/H5ComponentBase.js"></script>
    <link rel="stylesheet" href="../css/H5ComponentBase.css">
    <link rel="stylesheet" href="../css/H5.css">
    <script src="../js/H5ComponentBar.js"></script>
    <link rel="stylesheet" href="../css/H5ComponentBar.css">
    <style>
        body {
            margin: 0;
            padding: 0;
            background-color: #000;
            font-size: 12px;
        }

        .iphone {
            width: 340px;
            height: 540px;
            background-color: #fff;
            position: absolute;
            background-color: #fff;
            left: 50%;
            top: 50%;
            margin: -270px 0 0 -170px;
        }
    </style>
</head>

<body>
    <div class="iphone">

    </div>
    <script>
        var cfg = {
            type: 'bar',
            width: 400,
            height: 600,
            data: [
                ['Javascript', .4, '#ff7676'],
                ['HTML/CSS', .1],
                ['CSS3', .3],
                ['HTML5', .35],
                ['jQuery', .3],
                ['Bootstrap', .08],
                ['AngularJs', .09]
            ],
            css: {
                opacity: 0
            },
            animateIn:{
                opacity:1,
                top:200
            },
            animateOut:{
                opacity:0,
                top:100,
            },
            // animateIn: {
            //     top: 200,
            //     opacity: 1
            // },
            // animateOut: {
            //     top: 100,
            //     opacity: 0
            // },
            center: true
        };

        $(function () {

            var h5 = new H5ComponentBar('myBarComponent', cfg);
            $('.iphone').append(h5)
            var leave = true;
            $('body').click(function () {
                leave = !leave;
                console.log(leave);
                $('.h5_component').trigger(leave ? 'onLeave' : 'onLoad')
            })
        })
    </script>
</body>

</html>